home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / aurora2c.zip / INSTALL.AML < prev    next >
Text File  |  1995-04-07  |  8KB  |  326 lines

  1.  
  2. // ───────────────────────────────────────────────────────────────────
  3. // The Aurora Editor v2.0
  4. // Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
  5. //
  6. // Installation macro
  7. //
  8. // This macro installs all Aurora files to a user-specified path, and
  9. // also prompts the user for an editor style and color palette to use.
  10. // ───────────────────────────────────────────────────────────────────
  11.  
  12.   // compile time macros and function definitions
  13.   include  bootpath "define.aml"
  14.  
  15.   // message strings
  16.   title     = "Installation"
  17.   cancelmsg = "Installation canceled"
  18.   failmsg   = "Installation failed"
  19.   source_path = getpath (getbootpath)
  20.  
  21.   // create installation progress window
  22.   createwindow
  23.   setwinobj
  24.   setframe ">b"
  25.   setcolor  border_color   color white on gray
  26.   setcolor  text_color     color black on gray
  27.   settitle "Aurora v" + getversion + ' ' + title
  28.   setwinctrl '≡'
  29.   sizewindow 1 1  -1 -1 "rd"
  30.   setborder "1i"
  31.   display
  32.  
  33.   // get the install path
  34.   install_path = upcase (ask "Enter installation path:" ''
  35.                          source_path title 'd')
  36.   if not install_path then
  37.     msgbox cancelmsg title
  38.     destroywindow
  39.     return
  40.   end
  41.  
  42.   // add backslash if not present
  43.   if install_path [0] <> "\\" then
  44.     install_path = install_path + "\\"
  45.   end
  46.  
  47.   writestr "Installation path is " + install_path
  48.  
  49.   // check if the install path exists
  50.   if locatefile install_path '' 'd' then
  51.     if (okbox  "Path " + install_path +
  52.                " already exists, install over it?" title) <> "Ok" then
  53.       msgbox cancelmsg title
  54.       destroywindow
  55.       return
  56.     end
  57.  
  58.   // ..if not, then create it
  59.   else
  60.     if (okbox  "Path " + install_path +
  61.                 " is not found, create it?" title) <> "Ok" then
  62.       msgbox cancelmsg title
  63.       destroywindow
  64.       return
  65.     else
  66.       if not createdir install_path then
  67.         msgbox "Can't create path " + install_path + " - " + failmsg  title
  68.         destroywindow
  69.         return
  70.       end
  71.     end
  72.     install_path = getpath (qualify install_path)
  73.   end
  74.  
  75.  
  76.   // create the style menu
  77.   menu "mstyle"
  78.     item " &Aurora"                 "AU"
  79.     item " &Brief"                  "BR"
  80.     item " &QEdit/TSE"              "QE"
  81.     item " Word&Perfect"            "WP"
  82.     item " &WordStar/Borland IDE"   "WS"
  83.   end
  84.  
  85.   // get the editor style
  86.   style = popup "mstyle" "Which editor style would you like to use?"
  87.   destroybuf "mstyle"
  88.   if not style then
  89.     msgbox cancelmsg title
  90.     destroywindow
  91.     return
  92.   end
  93.  
  94.   writeline
  95.   writestr "Editor style is: " + style
  96.   display
  97.  
  98.   // create the color palette menu
  99.   menu "colors"
  100.     item " &Blue and green"   "blugreen"
  101.     item " &Fluorescent"      "fluoresc"
  102.     item " &Green charcoal"   "greench"
  103.     item " &Red and blue"     "redblue"
  104.     item " &Wimbledon"        "wimbledn"
  105.   end
  106.  
  107.   // get the color palette to use
  108.   palette = popup "colors" "Select a color palette to install" 37
  109.   destroybuf "colors"
  110.   if not palette then
  111.     msgbox cancelmsg title
  112.     destroywindow
  113.     return
  114.   end
  115.  
  116.   writeline
  117.   writestr "Editor color palette is: " + palette
  118.   display
  119.  
  120.   // define all installation directories and files
  121.   databuf "allfiles"
  122.  
  123.     // main files
  124.     "\\"
  125.     "a.exe"
  126.     "a.x"
  127.     "lib.x"
  128.     "install.x"
  129.     "install.aml"
  130.     "color.aml"
  131.     "config.aml"
  132.     "define.aml"
  133.     "ext.aml"
  134.     "file_id.diz"
  135.     "license.doc"
  136.     "main.aml"
  137.     "mouse.aml"
  138.     "orderfrm.doc"
  139.     "read.me"
  140.     "syntax.aml"
  141.     "syntax2.aml"
  142.     "system.aml"
  143.     "tran.aml"
  144.     "vendor.doc"
  145.  
  146.     // doc files
  147.     "doc\\"
  148.     "function.dox"
  149.     "language.dox"
  150.     "quickfun.dox"
  151.     "regexp.dox"
  152.     "tips.dox"
  153.     "user.dox"
  154.  
  155.     // macro files
  156.     "macro\\"
  157.     "calcpad.aml"
  158.     "calendar.aml"
  159.     "clrchart.aml"
  160.     "countchr.aml"
  161.     "countwrd.aml"
  162.     "delblank.aml"
  163.     "deldup.aml"
  164.     "drawbox.aml"
  165.     "entab.aml"
  166.     "example.aml"
  167.     "fulldate.aml"
  168.     "helplang.aml"
  169.     "helpuser.aml"
  170.     "keycodes.aml"
  171.     "keydef.aml"
  172.     "longline.aml"
  173.     "palette.aml"
  174.     "sumblock.aml"
  175.     "tabs.aml"
  176.     "utility.aml"
  177.     "viewmem.aml"
  178.  
  179.     // palette files
  180.     "palette\\"
  181.     "blugreen.aml"
  182.     "fluoresc.aml"
  183.     "greench.aml"
  184.     "redblue.aml"
  185.     "wimbledn.aml"
  186.  
  187.     // style files
  188.     "style\\"
  189.     "aukbd.aml"
  190.     "aumenu.aml"
  191.     "brkbd.aml"
  192.     "brmenu.aml"
  193.     "qekbd.aml"
  194.     "qemenu.aml"
  195.     "wpkbd.aml"
  196.     "wpmenu.aml"
  197.     "wskbd.aml"
  198.     "wsmenu.aml"
  199.   end
  200.  
  201.   // check for same-path installation
  202.   same_path = source_path == install_path
  203.  
  204.   // copy files
  205.   repeat
  206.     file = gettext
  207.     if file [0] == '\\' then
  208.       if file == '\\' then
  209.         path = if? same_path '' install_path
  210.       else
  211.         path = file
  212.         createdir install_path + path
  213.       end
  214.     elseif path then
  215.       source = qualify file source_path
  216.       if path == install_path then
  217.         dest = qualify file install_path
  218.       else
  219.         if not locatefile source then
  220.           source = qualify file source_path + path
  221.         end
  222.         dest = qualify file install_path + path
  223.       end
  224.  
  225.       writeline
  226.       writestr "Copying " + source + " to " + dest + "..."
  227.       display
  228.  
  229.       if source <> dest then
  230.         if copyfile source dest then
  231.           if same_path then
  232.             deletefile source
  233.           end
  234.         else
  235.           // error copying files
  236.           msgbox "Failed copying " + dest + ", " + failmsg  title
  237.           destroybuf "allfiles"
  238.           destroywindow
  239.           return
  240.         end
  241.       end
  242.  
  243.       // compile external macros
  244.       if path == "macro\\" then
  245.         // compile each macro, skip examples
  246.         if file <> "example.aml" then
  247.           writeline
  248.           writestr "Compiling " + dest + "..."
  249.           display
  250.           error = compilemacro dest dest [1 : (sizeof dest) - 3] + 'X'
  251.           if error then
  252.             msgbox "Error (" + error + ") compiling macro " + dest
  253.           end
  254.         end
  255.       end
  256.     end
  257.   until not down
  258.  
  259.   // destroy the file-list buffer
  260.   destroybuf "allfiles"
  261.  
  262.   // routine to copy style/palette files to the main install path
  263.   function  copys (src_path sfile dfile)
  264.     source = qualify sfile + ".AML" src_path
  265.     dest = qualify dfile + ".AML" install_path
  266.     writeline
  267.     writestr "Copying " + source + " to " + dest
  268.     display
  269.     // make a backup copy
  270.     copyfile dest (qualify dfile + ".OLD" install_path)
  271.     if not copyfile source dest then
  272.       // error copying files
  273.       msgbox "Failed copying " + dest + ", " + failmsg  title
  274.       destroywindow
  275.       return 1
  276.     end
  277.     return
  278.   end
  279.  
  280.   style_path = install_path + "STYLE\\"
  281.  
  282.   // copy keyboard style file
  283.   if copys style_path style + "KBD" "KBD" then
  284.     return
  285.   end
  286.  
  287.   // copy menu style file
  288.   if copys style_path style + "MENU" "MENU" then
  289.     return
  290.   end
  291.  
  292.   // copy color palette file
  293.   if copys install_path + "PALETTE\\"  palette "COLOR" then
  294.     return
  295.   end
  296.  
  297.   writeline
  298.   writestr "Recompiling the Editor..."
  299.   display
  300.  
  301.   // recompile the editor
  302.   save_boot = getbootpath
  303.   setbootpath install_path
  304.   error = regen
  305.   setbootpath save_boot
  306.  
  307.   if error then
  308.     msgbox "Compilation failed, " + failmsg  title
  309.     destroywindow
  310.     return
  311.   else
  312.     writeline
  313.     writestr "*** End of Installation *** "
  314.     display
  315.     msgbox "Installation is complete!  Add " + install_path + " to your PATH."  title
  316.     msgbox "To run Aurora, execute " +
  317.            (qualify "A.EXE" install_path) + " from the DOS command line."
  318.   end
  319.  
  320.   // destroy the installation progress window
  321.   destroywindow
  322.  
  323.   // return the install path if successful
  324.   return install_path
  325.  
  326.